//
//  CollectGoodsListModel.swift
//  Pods
//
//  Created by eme on 2017/3/30.
//
//

import Foundation
import SwiftyJSON
import ModelProtocol

class CollectGoodsListModel:ModelProtocol{
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kCollectGoodsListImg2Key: String = "img2"
    internal let kCollectGoodsListPdcertificateKey: String = "pdcertificate"
    internal let kCollectGoodsListPdstateKey: String = "pdstate"
    internal let kCollectGoodsListPdidKey: String = "pdid"
    internal let kCollectGoodsListCrdateKey: String = "crdate"
    internal let kCollectGoodsListPdbuilddateKey: String = "pdbuilddate"
    internal let kCollectGoodsListCidKey: String = "cid"
    internal let kCollectGoodsListImg1Key: String = "img1"
    internal let kCollectGoodsListPddesKey: String = "pddes"
    internal let kCollectGoodsListUseridKey: String = "userid"
    internal let kCollectGoodsListIsfixedpriceKey: String = "isfixedprice"
    internal let kCollectGoodsListImg5Key: String = "img5"
    internal let kCollectGoodsListPdcodeKey: String = "pdcode"
    internal let kCollectGoodsListIsareaKey: String = "isarea"
    internal let kCollectGoodsListBridKey: String = "brid"
    internal let kCollectGoodsListPddetailKey: String = "pddetail"
    internal let kCollectGoodsListImg3Key: String = "img3"
    internal let kCollectGoodsListSendtypeKey: String = "sendtype"
    internal let kCollectGoodsListSalecountKey: String = "salecount"
    internal let kCollectGoodsListPdnameKey: String = "pdname"
    internal let kCollectGoodsListPtidKey: String = "ptid"
    internal let kCollectGoodsListImg6Key: String = "img6"
    internal let kCollectGoodsListPdshedataKey: String = "pdshedata"
    internal let kCollectGoodsListIsexplosiveKey: String = "isexplosive"
    internal let kCollectGoodsListBdidKey: String = "bdid"
    internal let kCollectGoodsListPdremarkKey: String = "pdremark"
    internal let kCollectGoodsListPdunitKey: String = "pdunit"
    internal let kCollectGoodsListViewcountKey: String = "viewcount"
    internal let kCollectGoodsListSelfidKey: String = "selfid"
    internal let kCollectGoodsListImg4Key: String = "img4"
    internal let kCollectGoodsListPdupdaeKey: String = "pdupdae"
    internal let kCollectGoodsListPdtypeKey: String = "pdtype"
    internal let kCollectminshpriceKey: String = "minshprice"
    internal let kCollectbrnameKey: String = "brname"
    internal let kCollectstockKey: String = "stock"
    internal let kcollectistimeby: String = "istimeby"
    
    
    
    // MARK: 属性
    var img2: String
    var pdcertificate: String
    var pdstate: String
    var pdid: Int
    var crdate: String
    var pdbuilddate: String
    var cid: Int
    var img1: String
    var pddes: String
    var userid: Int
    var isfixedprice: String
    var img5: String
    var pdcode: String
    var isarea: String
    var brid: String
    var pddetail: String
    var img3: String
    var sendtype: String
    var salecount: Int
    var pdname: String
    var ptid: Int
    var img6: String
    var pdshedata: String
    var isexplosive: String
    var bdid: String
    var pdremark: String
    var pdunit: String
    var viewcount: Int
    var selfid: String
    var img4: String
    var pdupdae: String
    var pdtype: String
    var isclicked:Int = 0
    var minshprice:Double
    var brname:String
    var stock:String
    var istimeby:String
    var bdprice:Double
    
    //
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        img2 = json[kCollectGoodsListImg2Key].stringValue
        pdcertificate = json[kCollectGoodsListPdcertificateKey].stringValue
        pdstate = json[kCollectGoodsListPdstateKey].stringValue
        pdid = json[kCollectGoodsListPdidKey].intValue
        crdate = json[kCollectGoodsListCrdateKey].stringValue
        pdbuilddate = json[kCollectGoodsListPdbuilddateKey].stringValue
        cid = json[kCollectGoodsListCidKey].intValue
        img1 = json[kCollectGoodsListImg1Key].stringValue
        pddes = json[kCollectGoodsListPddesKey].stringValue
        userid = json[kCollectGoodsListUseridKey].intValue
        isfixedprice = json[kCollectGoodsListIsfixedpriceKey].stringValue
        img5 = json[kCollectGoodsListImg5Key].stringValue
        pdcode = json[kCollectGoodsListPdcodeKey].stringValue
        isarea = json[kCollectGoodsListIsareaKey].stringValue
        brid = json[kCollectGoodsListBridKey].stringValue
        pddetail = json[kCollectGoodsListPddetailKey].stringValue
        img3 = json[kCollectGoodsListImg3Key].stringValue
        sendtype = json[kCollectGoodsListSendtypeKey].stringValue
        salecount = json[kCollectGoodsListSalecountKey].intValue
        pdname = json[kCollectGoodsListPdnameKey].stringValue
        ptid = json[kCollectGoodsListPtidKey].intValue
        img6 = json[kCollectGoodsListImg6Key].stringValue
        pdshedata = json[kCollectGoodsListPdshedataKey].stringValue
        isexplosive = json[kCollectGoodsListIsexplosiveKey].stringValue
        bdid = json[kCollectGoodsListBdidKey].stringValue
        pdremark = json[kCollectGoodsListPdremarkKey].stringValue
        pdunit = json[kCollectGoodsListPdunitKey].stringValue
        viewcount = json[kCollectGoodsListViewcountKey].intValue
        selfid = json[kCollectGoodsListSelfidKey].stringValue
        img4 = json[kCollectGoodsListImg4Key].stringValue
        pdupdae = json[kCollectGoodsListPdupdaeKey].stringValue
        pdtype = json[kCollectGoodsListPdtypeKey].stringValue
        minshprice = json[kCollectminshpriceKey].doubleValue
        brname = json[kCollectbrnameKey].stringValue
        stock = json[kCollectstockKey].stringValue
        istimeby = json[kcollectistimeby].stringValue
        bdprice = json["bdprice"].doubleValue
        
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        
        dictionary.updateValue(img2 as AnyObject, forKey: kCollectGoodsListImg2Key)
        
        
        dictionary.updateValue(pdcertificate as AnyObject, forKey: kCollectGoodsListPdcertificateKey)
    
    
        dictionary.updateValue(pdstate as AnyObject, forKey: kCollectGoodsListPdstateKey)
    
    
        dictionary.updateValue(pdid as AnyObject, forKey: kCollectGoodsListPdidKey)
    
    
        dictionary.updateValue(crdate as AnyObject, forKey: kCollectGoodsListCrdateKey)
    
    
        dictionary.updateValue(pdbuilddate as AnyObject, forKey: kCollectGoodsListPdbuilddateKey)
    
    
        dictionary.updateValue(cid as AnyObject, forKey: kCollectGoodsListCidKey)
    
    
        dictionary.updateValue(img1 as AnyObject, forKey: kCollectGoodsListImg1Key)
    
    
        dictionary.updateValue(pddes as AnyObject, forKey: kCollectGoodsListPddesKey)
    
    
        dictionary.updateValue(userid as AnyObject, forKey: kCollectGoodsListUseridKey)
    
    
        dictionary.updateValue(isfixedprice as AnyObject, forKey: kCollectGoodsListIsfixedpriceKey)
    
    
        dictionary.updateValue(img5 as AnyObject, forKey: kCollectGoodsListImg5Key)
    
    
        dictionary.updateValue(pdcode as AnyObject, forKey: kCollectGoodsListPdcodeKey)
    
    
        dictionary.updateValue(isarea as AnyObject, forKey: kCollectGoodsListIsareaKey)
    
    
        dictionary.updateValue(brid as AnyObject, forKey: kCollectGoodsListBridKey)
    
    
        dictionary.updateValue(pddetail as AnyObject, forKey: kCollectGoodsListPddetailKey)
    
    
        dictionary.updateValue(img3 as AnyObject, forKey: kCollectGoodsListImg3Key)
    
    
        dictionary.updateValue(sendtype as AnyObject, forKey: kCollectGoodsListSendtypeKey)
    
    
        dictionary.updateValue(salecount as AnyObject, forKey: kCollectGoodsListSalecountKey)
    
    
        dictionary.updateValue(pdname as AnyObject, forKey: kCollectGoodsListPdnameKey)
    
    
        dictionary.updateValue(ptid as AnyObject, forKey: kCollectGoodsListPtidKey)
    
    
        dictionary.updateValue(img6 as AnyObject, forKey: kCollectGoodsListImg6Key)
    
   
        dictionary.updateValue(pdshedata as AnyObject, forKey: kCollectGoodsListPdshedataKey)
    
    
        dictionary.updateValue(isexplosive as AnyObject, forKey: kCollectGoodsListIsexplosiveKey)
    
    
        dictionary.updateValue(bdid as AnyObject, forKey: kCollectGoodsListBdidKey)
    
    
        dictionary.updateValue(pdremark as AnyObject, forKey: kCollectGoodsListPdremarkKey)
    
    
        dictionary.updateValue(pdunit as AnyObject, forKey: kCollectGoodsListPdunitKey)
    
    
        dictionary.updateValue(viewcount as AnyObject, forKey: kCollectGoodsListViewcountKey)
    
    
        dictionary.updateValue(selfid as AnyObject, forKey: kCollectGoodsListSelfidKey)
    
    
        dictionary.updateValue(img4 as AnyObject, forKey: kCollectGoodsListImg4Key)
    
    
        dictionary.updateValue(pdupdae as AnyObject, forKey: kCollectGoodsListPdupdaeKey)
    
    
        dictionary.updateValue(pdtype as AnyObject, forKey: kCollectGoodsListPdtypeKey)
    
    
        dictionary.updateValue(minshprice as AnyObject, forKey: kCollectminshpriceKey)
    
    
        dictionary.updateValue(brname as AnyObject , forKey: kCollectbrnameKey)
    
    
        dictionary.updateValue(stock as AnyObject, forKey: kCollectstockKey)
    
    
        dictionary.updateValue(istimeby as AnyObject, forKey: kcollectistimeby)
        
        dictionary.updateValue(bdprice as AnyObject, forKey: "bdprice")
        
        
        return dictionary
    }
    
    
}
